#include "form1.h"
#include "ui_form1.h"
#include <QString>
#include <QDebug>
Form1::Form1(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Form1)
{
    ui->setupUi(this);
}

Form1::~Form1()
{
    delete ui;
}

void Form1::on_pushButton_clicked()
{
x1.re=ui->lineEdit->text().toDouble();
x1.im=ui->lineEdit_2->text().toDouble();
x2.re=ui->lineEdit_4->text().toDouble();
x2.im=ui->lineEdit_3->text().toDouble();
otvet=x1+x2;
QString a;

ui->lineEdit_6->setText(a.setNum(otvet.re));
ui->lineEdit_5->setText(a.setNum(otvet.im));
}

void Form1::on_pushButton_2_clicked()
{
    x1.re=ui->lineEdit->text().toDouble();
    x1.im=ui->lineEdit_2->text().toDouble();
    x2.re=ui->lineEdit_4->text().toDouble();
    x2.im=ui->lineEdit_3->text().toDouble();
    otvet=x1-x2;
    QString a;
    ui->lineEdit_6->setText(a.setNum(otvet.re));
    ui->lineEdit_5->setText(a.setNum(otvet.im));
}

void Form1::on_pushButton_3_clicked()
{
    x1.re=ui->lineEdit->text().toDouble();
    x1.im=ui->lineEdit_2->text().toDouble();
    x2.re=ui->lineEdit_4->text().toDouble();
    x2.im=ui->lineEdit_3->text().toDouble();
    otvet=x1*x2;
    QString a;
    ui->lineEdit_6->setText(a.setNum(otvet.re));
    ui->lineEdit_5->setText(a.setNum(otvet.im));
}

void Form1::on_pushButton_4_clicked()
{
    x1.re=ui->lineEdit->text().toDouble();
    x1.im=ui->lineEdit_2->text().toDouble();
    x2.re=ui->lineEdit_4->text().toDouble();
    x2.im=ui->lineEdit_3->text().toDouble();
    otvet=x1/x2;
    QString a;
    ui->lineEdit_6->setText(a.setNum(otvet.re));
    ui->lineEdit_5->setText(a.setNum(otvet.im));
}



void Form1::on_pushButton_5_clicked()
{
    x1.re=ui->lineEdit->text().toDouble();
    x1.im=ui->lineEdit_2->text().toDouble();
    x2.re=ui->lineEdit_4->text().toDouble();
    x2.im=ui->lineEdit_3->text().toDouble();
    otvet=x1.abs();

    QString a;
    ui->lineEdit_6->setText(a.setNum(otvet.re));
    ui->lineEdit_5->setText(a.setNum(otvet.im));
}
